# See https://github.com/RadeonOpenCompute/rocm_smi_lib/blob/master/python_smi_tools/rsmiBindings.py
import ctypes
import sys

from typing import Any
from typing import Literal

if sys.version_info[:2] >= (3, 11):
  from typing import LiteralString
else:
  from typing_extensions import LiteralString

class rocmsmi(ctypes.CDLL):
  @staticmethod
  def rsmi_num_monitor_devices(num_devices: ctypes._CArgObject) -> Any: ...
# Device ID
dv_id: ctypes.c_uint64 = ...
# GPU ID
gpu_id: ctypes.c_uint32 = ...

# Policy enums
RSMI_MAX_NUM_FREQUENCIES: Literal[32] = ...
RSMI_MAX_FAN_SPEED: Literal[255] = ...
RSMI_NUM_VOLTAGE_CURVE_POINTS: Literal[3] = ...

class rsmi_status_t(ctypes.c_int):
  RSMI_STATUS_SUCCESS: Literal[0x0] = ...
  RSMI_STATUS_INVALID_ARGS: Literal[0x1] = ...
  RSMI_STATUS_NOT_SUPPORTED: Literal[0x2] = ...
  RSMI_STATUS_FILE_ERROR: Literal[0x3] = ...
  RSMI_STATUS_PERMISSION: Literal[0x4] = ...
  RSMI_STATUS_OUT_OF_RESOURCES: Literal[0x5] = ...
  RSMI_STATUS_INTERNAL_EXCEPTION: Literal[0x6] = ...
  RSMI_STATUS_INPUT_OUT_OF_BOUNDS: Literal[0x7] = ...
  RSMI_STATUS_INIT_ERROR: Literal[0x8] = ...
  RSMI_INITIALIZATION_ERROR = RSMI_STATUS_INIT_ERROR
  RSMI_STATUS_NOT_YET_IMPLEMENTED: Literal[0x9] = ...
  RSMI_STATUS_NOT_FOUND: Literal[0xA] = ...
  RSMI_STATUS_INSUFFICIENT_SIZE: Literal[0xB] = ...
  RSMI_STATUS_INTERRUPT: Literal[0xC] = ...
  RSMI_STATUS_UNEXPECTED_SIZE: Literal[0xD] = ...
  RSMI_STATUS_NO_DATA: Literal[0xE] = ...
  RSMI_STATUS_UNKNOWN_ERROR: Literal[0xFFFFFFFF] = ...

# Dictionary of rsmi ret codes and it's verbose output
rsmi_status_verbose_err_out: dict[LiteralString, LiteralString] = ...
